package q268_missingNumber;

import java.util.Arrays;

public class Solution_1 {
    public int missingNumber(int[] nums) {
        int[] temps = new int[nums.length + 1];
        Arrays.fill(temps, -1);
        for (int i = 0; i < nums.length; i++) {
            temps[nums[i]] = nums[i];
        }

        for (int i = 0; i < temps.length; i++) {
            if (temps[i] == -1) {
                return i;
            }
        }
        return 0;
    }

}
